{extend name="$member_base" /}
{block name="right_main"}
<link rel="stylesheet" href="WEB_CSS/member_goods.css">
{php}
$virtual_goods_data = api('System.Member.virtualGoodsList', ['page_index' => $page_index]);
$virtual_list = $virtual_goods_data['data']['data'];
$total_count = $virtual_goods_data['data']['total_count'];
{/php}
<div class="member-main">
	<div class="main-top">
		<div class="title">我的虚拟码</div>
	</div>
	<table class="table table-borderless">
		<colgroup>
            <col width="45%">
            <col width="20%">
         	<col width="15%">
            <col width="10%">
            <col width="10%">
        </colgroup>
		<thead>
			<tr>
	      		<th class="align-left">商品名称</th>
	      		<th class="align-left">虚拟码</th>
	      		<th class="align-left">创建时间</th>
	      		<th class="align-left">过期时间</th>
	      		<th class="align-left">操作</th>
		    </tr>
	  	</thead>
		<tbody>
			{notempty name="$virtual_list"}
				{foreach $virtual_list as $vo}
					<tr class="mouseover-picture">
						<td class="align-left">{$vo.virtual_goods_name}</td>
						<td class="align-left">{$vo.virtual_code}</td>
						<td class="align-left">{$vo.create_time | getTimeStampTurnTime}</td>
						<td class="align-left">{if condition="$vo.end_time != 0"}{$vo.end_time | getTimeStampTurnTime}{else/}不限制{/if}</td>
						<td>
						{switch $vo.goods_type }
						    {case value="0"}
						    	<!-- 普通虚拟商品 -->
						    	<a href="javascript:void(0);"data-toggle="popover" data-placement="right" data-html="true"data-content="<img src='{:__IMG($vo.path)}'/>"  title="核销码">查看</a>
						    {/case}
							{case value="2"}
								<!-- 下载类商品 -->
						    	<a href="javascript:void(0);"data-toggle="popover" data-placement="right" data-html="true"data-content="<span>{$vo.virtual_goods_name}</span>&nbsp;&nbsp;&nbsp;<a href='{:__URL('SHOP_MAIN/order/download','virtual_code='.$vo['virtual_code'])}'><span class='download-tip ns-text-color'>点击下载</span></a>"  title="附件下载">查看</a>
						    {/case}
						    {case value="3"}
								<!-- 网盘类商品 -->
						    	<a href="javascript:void(0);"data-toggle="popover" data-placement="right" data-html="true"data-content="<div><span>网盘地址/提取码:</span>{$vo.remark}</div>"  title="网盘下载">查看</a>
						    {/case}
						    {case value="4"}
								<!-- 卡券类商品 -->
						    	<a href="javascript:void(0);"data-toggle="popover" data-placement="right" data-html="true"data-content="<div><span>卡号/密码:</span>{$vo.remark}</div>"  title="卡券/密码">查看</a>
						    {/case}
						{/switch}
						</td>
					</tr>
				{/foreach}
			{else/}
				<tr>
					<td class="align-center" colspan="5">暂无相关数据！</td>
				</tr>
			{/notempty}
		</tbody>
	</table>
	{if condition="$total_count>0"}
	<ul class="pager" data-ride="pager" data-elements="prev,nav,next,total_page_text,goto" data-rec-per-page="{$page_size}" data-page="{$page_index}" data-rec-total="{$total_count}" id="myPager"></ul>
	{/if}
</div>
{/block}
{block name="script"}
<script>
$('#myPager').pager({
	linkCreator: function(page, pager) {
		return __URL("SHOP_MAIN/member/goods?page="+page);
	}
});
$(function(){
	$('[data-toggle="popover"]').click(function(){
		$('[data-toggle="popover"]').not(this).popover('hide');
	});
	//或者在初始化时指定弹出方向
	$('[data-toggle="popover"]').popover();
	//为了解决弹出框错位冲突,手动触发点击事件,自动校准
	$('[data-toggle="popover"]').click();
	$('[data-toggle="popover"]').click();
});
</script>
{/block}